package com.lxw.report.meta.enums;

import org.apache.commons.lang3.StringUtils;

/**
 * Created by Administrator on 2019/7/25 9:27
 */
public enum DbTypeEnum {
    MYSQL("com.mysql.jdbc.Driver"),
    IMPALA("org.apache.hive.jdbc.HiveDriver");

    private String driverClassName;

    DbTypeEnum(String driverClassName){
        this.driverClassName=driverClassName;
    }

    public String getDriverClassName() {
        return this.driverClassName;
    }

    public static String getDriverByName(String name) {
        if(StringUtils.isBlank(name)){
            return null;
        }
        for(DbTypeEnum typeEnum:DbTypeEnum.values()){
            if(typeEnum.name().equals(name)){
                return typeEnum.getDriverClassName();
            }
        }
        return null;
    }

}
